﻿@{
    Layout = null;
}
<script>

var setting = 
{
			data: {
				simpleData: {
					enable: true
				}
			},
            callback: {
			beforeClick: function(treeId, treeNode) {
				var zTree = $.fn.zTree.getZTreeObj("tree");
                 //当前值
				  currVal=treeNode.val;
                  $("#currtxt").html(treeNode.name);
			}
		   }
};
$(function()
{
  info();
});

function info()
{
 //请求回数据
 $.AjaxServer("@(Url.Action("DoFolderTree"))",{},function(data)
 {
    	$.fn.zTree.init($("#treeDemo"), setting, data);
 });
}
var currVal=null;
</script>
<div class="zTreeDemoBackground left">
    <ul id="treeDemo" class="ztree">
     加载中...
    </ul>
</div>

<a id="currtxt" class="btn" >当前未选择</a>
 <a style=" float:right" href="#" class="btn" onclick="return closeEdit(this)">取消</a>

<a  style=" float:right" onclick="yesCurr(this)" class="btn btn-danger">
    确认</a>
<script>
    //关闭
    function closeEdit(obj)
    {
        getCurrentDialog(obj).close();
        return false;
    }

    //选中
    function yesCurr(obj) 
    {
    alert(currVal);
        if (currVal == null) {
            $.alert("请选中一个文件夹");
        } else 
        {
            $.SetDoubleDialog(currVal, $("#currtxt").html(), obj);
        }
    }
</script>
